
#pragma once

#include "..\\ExternalTools\\ExternalTools.h"

#include "..\\Loirey\\loirey_GLOBAL.h"
#include "..\\Loirey\\loirey_MyMath.h"
#include "..\\Loirey\\loirey_BasicStructure.h"

#include "cvf_ImageFilter.h"
#include "cvf_Gradient.h"
#include "cvf_DefaultFilters.h"

using namespace loirey;

class CPointInRectangleRandomSampler
{
public:
	int W, H, WH;
	CSimpleTypeArray<int> SampledPixelList;
	CSimpleTypeArray<int> NearestSampledPixelList;

public:
	void Work(int W, int H, int SampleMargin, double SampleRate);
	void Work(int W, int H, int SampleMargin, double SampleRate, const CSimpleTypeArray<int>& PreselectedPointList);
	void Work(int W, int H, int SampleMargin, double SampleRate_Pre, double SampleRate_Rnd, const CSimpleTypeArray<int>& PreselectedPointList);
	void ComputeNearestSampledPointList();
};

class CImagePixelSampler_EdgeAndRandom
{
public:
	static const int COLOR_MODE_GRAY = -1;
	static const int COLOR_MODE_RGB = -2;
public:
	int ColorMode;
	double Canny_GaussianSigma;
	double Canny_tLow;
	double Canny_tHigh;
	int Edge_LengthThreshold;
	double Edge_DirectionThreshold;
	double Edge_SampleRate;
	int Random_SampleMargin;
	double Random_SampleRate;
	int BoundaryMargin;
public:
//protected:
	CImageFilterBank* _pIFB;
	
protected:
	void myRelease();
public:
	CImagePixelSampler_EdgeAndRandom();
	~CImagePixelSampler_EdgeAndRandom();
	void SetDefaultParameters();
	void Prepare();
	void Work(CSimpleTypeArray<int>& DstSampledPixelList, const CImg<int>& imgSrc);
};

